package com.Biomedica.virtualpowerpoint;

import java.io.IOException;
import java.util.Set;
import java.util.UUID;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.Intent;
import android.os.ParcelUuid;

public class BluetoothChannelSender {
	
	private static final int REQUEST_ENABLE_BT = 1;
	BluetoothAdapter _bt;
	Boolean btIsPresent;
	Set<BluetoothDevice> pairedDevices;
	BluetoothSocket socket;
	BluetoothServerSocket server;
	
	public BluetoothChannelSender(Context context) throws Exception
	{
		_bt=BluetoothAdapter.getDefaultAdapter();
		if(_bt==null)
		{
			btIsPresent=false;
			throw new Exception("Blue tooth is not present in the device");
		}
		else btIsPresent=true;
		
	
	}
	
	public void initBT(BluetoothDevice div) throws IOException
	{
		ParcelUuid[] u = div.getUuids();
	
		server=_bt.listenUsingRfcommWithServiceRecord(div.getName(),u[0].getUuid());
	    server.accept();
	    server.close();
	
	}
	public void OpenConnection(){
		
	}
	public void CloseConnection()
	{
		
	}
	public void Send(String Message)
	{
		
	}

	public void Connect2BT(BluetoothDevice div)
	{
		
	}
	public Boolean getBTEnabled() {
		return _bt.isEnabled();
	}
	public Set<BluetoothDevice> getpairedDevices()
	{
		return pairedDevices;
	}
	
	

}
